package com.api.shopapi.service.impl;

import com.api.shopapi.entity.ActivityContent;
import com.api.shopapi.entity.TrainRecord;
import com.api.shopapi.mapper.TrainRecordMapper;
import com.api.shopapi.mapper.UserAddressMapper;
import com.api.shopapi.service.TrainRecordService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("TrainRecordServiceImplOne")
public class TrainRecordServiceImplOne implements TrainRecordService {

    @Autowired
    private TrainRecordMapper trainRecordMapper;

    @Override
    public
    int insert(TrainRecord trainRecord){
        return trainRecordMapper.insert(trainRecord);
    }

    @Override
    public
    int update(TrainRecord trainRecord){
        return trainRecordMapper.update(trainRecord);
    }

    @Override
    public
    TrainRecord getByTrainRecordCode(String trainRecordCode){
        return trainRecordMapper.getByTrainRecordCode(trainRecordCode);
    }

    @Override
    public
    PageInfo<TrainRecord> getPageList(int pageIndex, int pageSize, String governmentCode,
                                      String startTime, String endTime){
        PageHelper.startPage(pageIndex,pageSize);
        List<TrainRecord> complaintList = trainRecordMapper.getPageList(governmentCode,
                startTime,endTime);
        return new PageInfo<>(complaintList);
    }



}
